from requests import get


def get_caihongpi(caihongpi_key):
    url = "http://api.tianapi.com/caihongpi/index?key={}".format(caihongpi_key)

    json = get(url).json()
    if 200 == json.get('code', '0'):
        return json['newslist'][0]['content']
    return '甜有100种，吃糖，还有每天99次的想你'

# if __name__ == '__main__':
#     print(get_caihongpi())
